﻿#ifndef PACKET_H
#define PACKET_H

#include <pthread.h>

typedef struct SocketNode {
    int fd;
    unsigned int seq;
    unsigned int ack;
    char* src_ip;  // 源 IP 地址
    unsigned short int src_port;  // 源端口
    char* dst_ip;  // 目标 IP 地址
    unsigned short int dst_port;  // 目标端口
    struct SocketNode* next;  // 指向下一个节点的指针
    int close;
    pthread_mutex_t lock;
} SocketNode;

void packet_syn_ack(int tun_fd, SocketNode* socket_node);

void packet_ack(int tun_fd, SocketNode* socket_node);

void packet_push(int tun_fd, SocketNode* socket_node, char* data, size_t data_len);

void packet_fin(int tun_fd, SocketNode* socket_node);

void packet_rst(int tun_fd, SocketNode* socket_node);


#endif // PACKET_H